import React,{useState,useEffect} from 'react'
import { Carousel } from 'antd';
import axios from '../utils/axios';
const contentStyle = {
    margin: 0,
    height: '160px',
    color: '#fff',
    lineHeight: '160px',
    textAlign: 'center',
    background: '#364d79',
  };
function MySwiper() {
    const [arr,setArr] = useState([])
    useEffect(()=>{
        axios.get("/api/imglist").then(res=>{
            setArr(res.data)
        })
    },[])
    const onChange = (currentSlide) => {
        console.log(currentSlide);
    };
  return (
    <div>
         <Carousel afterChange={onChange} autoplay={true}>
            {
                arr.map((item,index)=>{
                    return <img alt='' src={item} key={index}></img>
                })
            }  
    </Carousel>
    </div>
  )
}

export default MySwiper